package com.acme.ioniolab.copyfile;

import java.io.IOException;

import com.acme.ioniolab.copyfile.implementation.IOFileCopier;
import com.acme.ioniolab.copyfile.implementation.NIOFileCopier;

public class FileCopierTest {

	private static final int NUM_ITERATIONS = 1000;

	public static void main(String[] args) throws IOException {
		long start = 0;
		FileCopier copier = new IOFileCopier();
		
		start = System.currentTimeMillis();
		for (int i=0; i < NUM_ITERATIONS; i++)
			copier.copyFile(args[0], args[1]);
		System.out.printf("IO copy time %d ms\n", (System.currentTimeMillis()-start)/NUM_ITERATIONS);
		
		copier = new NIOFileCopier();
		start = System.currentTimeMillis();
		for (int i=0; i < NUM_ITERATIONS; i++)
			copier.copyFile(args[0], args[1]);
		System.out.printf("NIO copy time %d ms\n", (System.currentTimeMillis()-start)/NUM_ITERATIONS);
	}
}
